<?php

class Zend_View_Helper_ToolbarItem extends Zend_View_Helper_Abstract
{
    public $view;

    public function toolbarItem($label,$resource,$frame,$class='',$showlabel='false',$filter=null)
    {
        $params = array(
            'url'       => '/' . str_replace('.','/',$resource),
            'frame'     => $frame,
            'class'     => $class,
            'showlabel' => $showlabel,
            'label'     => $label,
            'disabled'  => isset($this->view->resources[$resource]) ? '' : 'disabled' 
        ); 
        if($filter) $params['url'] = sprintf('%s/%s/%s', $params['url'], $filter->param, $filter->value);
        return $this->view->partial('ToolbarItem.phtml', $params);
    }

    public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
    }
}
?>
